using System;
using System.Diagnostics;

namespace IBNet
{
   /// <summary>
   /// Error Event Arguments
   /// </summary>
   [DebuggerDisplay("{errorMessage} ")]
   public class ErrorEventArgs : EventArgs
   {
      private readonly ErrorMessage errorCode;
      private readonly string errorMessage;
      private readonly int id;

      /// <summary>
      /// Creates a new ErrorEventArgs.
      /// </summary>
      /// <param name="id">The orderId or requestId of the request that generated the error.</param>
      /// <param name="errorCode">Error codes are documented in the Error Codes topic.</param>
      /// <param name="errorMessage">This is the textual description of the error, also documented in the Error Codes topic.</param>
      public ErrorEventArgs(int id, ErrorMessage errorCode, string errorMessage)
      {
         this.id = id;
         this.errorMessage = errorMessage;
         this.errorCode = errorCode;
      }

      /// <summary>
      /// Gets the orderId or requestId of the request that generated the error.
      /// </summary>
      public int Id
      {
         get { return id; }
      }

      /// <summary>
      /// Gets the error code.
      /// </summary>
      public ErrorMessage ErrorCode
      {
         get { return errorCode; }
      }

      /// <summary>
      /// Gets the description of the error.
      /// </summary>
      public string ErrorMessage
      {
         get { return errorMessage; }
      }
   }
}